// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Author: Markus Gutschke

#ifndef OAUTH2_H__
#define OAUTH2_H__

#include <time.h>

#include "json.h"


struct OAuth2 {
  char   *url;
  char   *clientId;
  char   *clientSecret;
  char   *refreshToken;
  char   *accessToken;
  time_t expiresAt;
};

struct OAuth2 *newOAuth2(const char *url, const char *clientId,
                         const char *clientSecret, const char *authCode,
                         const char *refreshToken);
void initOAuth2(struct OAuth2 *oauth2, const char *url, const char *clientId,
                const char *clientSecret, const char *authCode,
                const char *refreshToken);
void destroyOAuth2(struct OAuth2 *oauth2);
void deleteOAuth2(struct OAuth2 *oauth2);
void refreshOAuth2(struct OAuth2 *oauth2, const char *authCode);

#endif  // OAUTH2_H__
